<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE BangPatterns, CPP, Rank2Types #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# OPTIONS_HADDOCK not-home #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- Module      : Data.Text.Internal.Builder</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- Copyright   : (c) 2013 Bryan O'Sullivan</span><span>
</span><span id="line-8"></span><span class="hs-comment">--               (c) 2010 Johan Tibell</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- License     : BSD-style (see LICENSE)</span><span>
</span><span id="line-10"></span><span class="hs-comment">--</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Maintainer  : Johan Tibell &lt;johan.tibell@gmail.com&gt;</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Stability   : experimental</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Portability : portable to Hugs and GHC</span><span>
</span><span id="line-14"></span><span class="hs-comment">--</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- /Warning/: this is an internal module, and does not have a stable</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- API or name. Functions in this module may not check or enforce</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- preconditions expected by public modules. Use at your own risk!</span><span>
</span><span id="line-18"></span><span class="hs-comment">--</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- Efficient construction of lazy @Text@ values.  The principal</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- operations on a @Builder@ are @singleton@, @fromText@, and</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- @fromLazyText@, which construct new builders, and 'mappend', which</span><span>
</span><span id="line-22"></span><span class="hs-comment">-- concatenates two builders.</span><span>
</span><span id="line-23"></span><span class="hs-comment">--</span><span>
</span><span id="line-24"></span><span class="hs-comment">-- To get maximum performance when building lazy @Text@ values using a</span><span>
</span><span id="line-25"></span><span class="hs-comment">-- builder, associate @mappend@ calls to the right.  For example,</span><span>
</span><span id="line-26"></span><span class="hs-comment">-- prefer</span><span>
</span><span id="line-27"></span><span class="hs-comment">--</span><span>
</span><span id="line-28"></span><span class="hs-comment">-- &gt; singleton 'a' `mappend` (singleton 'b' `mappend` singleton 'c')</span><span>
</span><span id="line-29"></span><span class="hs-comment">--</span><span>
</span><span id="line-30"></span><span class="hs-comment">-- to</span><span>
</span><span id="line-31"></span><span class="hs-comment">--</span><span>
</span><span id="line-32"></span><span class="hs-comment">-- &gt; singleton 'a' `mappend` singleton 'b' `mappend` singleton 'c'</span><span>
</span><span id="line-33"></span><span class="hs-comment">--</span><span>
</span><span id="line-34"></span><span class="hs-comment">-- as the latter associates @mappend@ to the left.</span><span>
</span><span id="line-35"></span><span class="hs-comment">--</span><span>
</span><span id="line-36"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Text.Internal.Builder</span><span>
</span><span id="line-39"></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-comment">-- * Public API</span></span><span>
</span><span id="line-40"></span><span>     </span><span class="annot"><span class="hs-comment">-- ** The Builder type</span></span><span>
</span><span id="line-41"></span><span>     </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier">Builder</span></a></span><span>
</span><span id="line-42"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#toLazyText"><span class="hs-identifier">toLazyText</span></a></span><span>
</span><span id="line-43"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#toLazyTextWith"><span class="hs-identifier">toLazyTextWith</span></a></span><span>
</span><span id="line-44"></span><span>
</span><span id="line-45"></span><span>     </span><span class="annot"><span class="hs-comment">-- ** Constructing Builders</span></span><span>
</span><span id="line-46"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#singleton"><span class="hs-identifier">singleton</span></a></span><span>
</span><span id="line-47"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#fromText"><span class="hs-identifier">fromText</span></a></span><span>
</span><span id="line-48"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#fromLazyText"><span class="hs-identifier">fromLazyText</span></a></span><span>
</span><span id="line-49"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#fromString"><span class="hs-identifier">fromString</span></a></span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span>     </span><span class="annot"><span class="hs-comment">-- ** Flushing the buffer state</span></span><span>
</span><span id="line-52"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#flush"><span class="hs-identifier">flush</span></a></span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span>     </span><span class="annot"><span class="hs-comment">-- * Internal functions</span></span><span>
</span><span id="line-55"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#append%27"><span class="hs-identifier">append'</span></a></span><span>
</span><span id="line-56"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#ensureFree"><span class="hs-identifier">ensureFree</span></a></span><span>
</span><span id="line-57"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#writeN"><span class="hs-identifier">writeN</span></a></span><span>
</span><span id="line-58"></span><span>   </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.ST.html#"><span class="hs-identifier">Control.Monad.ST</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier">ST</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#runST"><span class="hs-identifier">runST</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Monoid.html#"><span class="hs-identifier">Data.Monoid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier">Monoid</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#if !MIN_VERSION_base(4,11,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Semigroup</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Semigroup</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.html"><span class="hs-identifier">Data.Text.Internal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier">Text</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#safe"><span class="hs-keyword">safe</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-66"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Lazy.html"><span class="hs-identifier">Data.Text.Internal.Lazy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Lazy.html#smallChunkSize"><span class="hs-identifier">smallChunkSize</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-67"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html"><span class="hs-identifier">Data.Text.Unsafe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Unsafe.html#inlineInterleaveST"><span class="hs-identifier">inlineInterleaveST</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Unsafe.Char.html"><span class="hs-identifier">Data.Text.Internal.Unsafe.Char</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Unsafe.Char.html#unsafeWrite"><span class="hs-identifier">unsafeWrite</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier">map</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/System.IO.html#putChar"><span class="hs-identifier">putChar</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-70"></span><span>
</span><span id="line-71"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.String.html#"><span class="hs-identifier">Data.String</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">String</span></span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Text.html"><span class="hs-identifier">Data.Text</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">S</span></span><span>
</span><span id="line-73"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Text.Array.html"><span class="hs-identifier">Data.Text.Array</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">A</span></span><span>
</span><span id="line-74"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Text.Lazy.html"><span class="hs-identifier">Data.Text.Lazy</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">L</span></span><span class="hs-cpp">

#if defined(ASSERTS)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">GHC.Stack</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">HasCallStack</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-80"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-81"></span><span>
</span><span id="line-82"></span><span class="hs-comment">-- | A @Builder@ is an efficient way to build lazy @Text@ values.</span><span>
</span><span id="line-83"></span><span class="hs-comment">-- There are several functions for constructing builders, but only one</span><span>
</span><span id="line-84"></span><span class="hs-comment">-- to inspect them: to extract any data, you have to turn them into</span><span>
</span><span id="line-85"></span><span class="hs-comment">-- lazy @Text@ values using @toLazyText@.</span><span>
</span><span id="line-86"></span><span class="hs-comment">--</span><span>
</span><span id="line-87"></span><span class="hs-comment">-- Internally, a builder constructs a lazy @Text@ by filling arrays</span><span>
</span><span id="line-88"></span><span class="hs-comment">-- piece by piece.  As each buffer is filled, it is \'popped\' off, to</span><span>
</span><span id="line-89"></span><span class="hs-comment">-- become a new chunk of the resulting lazy @Text@.  All this is</span><span>
</span><span id="line-90"></span><span class="hs-comment">-- hidden from the user of the @Builder@.</span><span>
</span><span id="line-91"></span><span class="hs-keyword">newtype</span><span> </span><span id="Builder"><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-var">Builder</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Builder"><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-var">Builder</span></a></span></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-92"></span><span>     </span><span class="hs-comment">-- Invariant (from Data.Text.Lazy):</span><span>
</span><span id="line-93"></span><span>     </span><span class="hs-comment">--      The lists include no null Texts.</span><span>
</span><span id="line-94"></span><span>     </span><span id="runBuilder"><span class="annot"><span class="annottext">Builder
-&gt; forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
</span><a href="Data.Text.Internal.Builder.html#runBuilder"><span class="hs-identifier hs-var hs-var">runBuilder</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679114539"><span class="annot"><a href="#local-6989586621679114539"><span class="hs-identifier hs-type">s</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114539"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114539"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">S.Text</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-95"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114539"><span class="hs-identifier hs-type">s</span></a></span><span>
</span><span id="line-96"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114539"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">S.Text</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-97"></span><span>   </span><span class="hs-special">}</span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679114425"><span id="local-6989586621679114427"><span class="annot"><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier hs-type">Semigroup</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-100"></span><span>   </span><span id="local-6989586621679114423"><span class="annot"><span class="annottext">&lt;&gt; :: Builder -&gt; Builder -&gt; Builder
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">(&lt;&gt;)</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Builder -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#append"><span class="hs-identifier hs-var">append</span></a></span><span>
</span><span id="line-101"></span><span>   </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&lt;&gt;</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-102"></span><span>
</span><span id="line-103"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-104"></span><span>   </span><span id="local-6989586621679114414"><span class="annot"><span class="annottext">mempty :: Builder
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var hs-var hs-var hs-var">mempty</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="Data.Text.Internal.Builder.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-105"></span><span>   </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-pragma hs-type">mempty</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-106"></span><span>   </span><span id="local-6989586621679114411"><span class="annot"><span class="annottext">mappend :: Builder -&gt; Builder -&gt; Builder
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-identifier hs-var hs-var hs-var hs-var">mappend</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Builder -&gt; Builder
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">(&lt;&gt;)</span></a></span><span>
</span><span id="line-107"></span><span>   </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-pragma hs-type">mappend</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-108"></span><span>   </span><span id="local-6989586621679114406"><span class="annot"><span class="annottext">mconcat :: [Builder] -&gt; Builder
</span><a href="../../base/src/GHC.Base.html#mconcat"><span class="hs-identifier hs-var hs-var hs-var hs-var">mconcat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Builder -&gt; Builder -&gt; Builder) -&gt; Builder -&gt; [Builder] -&gt; Builder
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Builder -&gt; Builder
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-identifier hs-var">mappend</span></a></span><span> </span><span class="annot"><span class="annottext">Builder
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">Data.Monoid.mempty</span></a></span><span>
</span><span id="line-109"></span><span>   </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#mconcat"><span class="hs-pragma hs-type">mconcat</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-110"></span><span>
</span><span id="line-111"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../base/src/Data.String.html#IsString"><span class="hs-identifier hs-type">String.IsString</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-112"></span><span>    </span><span id="local-6989586621679114401"><span class="annot"><span class="annottext">fromString :: String -&gt; Builder
</span><a href="../../base/src/Data.String.html#fromString"><span class="hs-identifier hs-var hs-var hs-var hs-var">fromString</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#fromString"><span class="hs-identifier hs-var">fromString</span></a></span><span>
</span><span id="line-113"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Data.String.html#fromString"><span class="hs-pragma hs-type">fromString</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-114"></span><span>
</span><span id="line-115"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679114396"><span id="local-6989586621679114399"><span class="annot"><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-116"></span><span>    </span><span id="local-6989586621679114392"><span class="annot"><span class="annottext">show :: Builder -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var hs-var hs-var hs-var">show</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; String) -&gt; (Builder -&gt; Text) -&gt; Builder -&gt; String
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Text
</span><a href="Data.Text.Internal.Builder.html#toLazyText"><span class="hs-identifier hs-var">toLazyText</span></a></span><span>
</span><span id="line-117"></span><span>
</span><span id="line-118"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679114387"><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Eq"><span class="hs-identifier hs-type">Eq</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-119"></span><span>    </span><span id="local-6989586621679114383"><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679114383"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679114382"><span class="annot"><span class="annottext">== :: Builder -&gt; Builder -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">==</span></a></span></span><span> </span><span id="local-6989586621679114381"><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679114381"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Text
</span><a href="Data.Text.Internal.Builder.html#toLazyText"><span class="hs-identifier hs-var">toLazyText</span></a></span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679114383"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Text
</span><a href="Data.Text.Internal.Builder.html#toLazyText"><span class="hs-identifier hs-var">toLazyText</span></a></span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679114381"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-120"></span><span>
</span><span id="line-121"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679114366"><span id="local-6989586621679114368"><span id="local-6989586621679114370"><span id="local-6989586621679114372"><span id="local-6989586621679114375"><span id="local-6989586621679114377"><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-identifier hs-type">Ord</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-122"></span><span>    </span><span id="local-6989586621679114362"><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679114362"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679114361"><span class="annot"><span class="annottext">&lt;= :: Builder -&gt; Builder -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;=</span></a></span></span><span> </span><span id="local-6989586621679114359"><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679114359"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Text
</span><a href="Data.Text.Internal.Builder.html#toLazyText"><span class="hs-identifier hs-var">toLazyText</span></a></span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679114362"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Text
</span><a href="Data.Text.Internal.Builder.html#toLazyText"><span class="hs-identifier hs-var">toLazyText</span></a></span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679114359"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-123"></span><span>
</span><span id="line-124"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-125"></span><span>
</span><span id="line-126"></span><span class="hs-comment">-- | /O(1)./ The empty @Builder@, satisfying</span><span>
</span><span id="line-127"></span><span class="hs-comment">--</span><span>
</span><span id="line-128"></span><span class="hs-comment">--  * @'toLazyText' 'empty' = 'L.empty'@</span><span>
</span><span id="line-129"></span><span class="hs-comment">--</span><span>
</span><span id="line-130"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#empty"><span class="hs-identifier hs-type">empty</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-131"></span><span id="empty"><span class="annot"><span class="annottext">empty :: Builder
</span><a href="Data.Text.Internal.Builder.html#empty"><span class="hs-identifier hs-var hs-var">empty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-var">Builder</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679114358"><span class="annot"><span class="annottext">Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114358"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679114357"><span class="annot"><span class="annottext">Buffer s
</span><a href="#local-6989586621679114357"><span class="hs-identifier hs-var">buf</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114358"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer s
</span><a href="#local-6989586621679114357"><span class="hs-identifier hs-var">buf</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-132"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#empty"><span class="hs-pragma hs-type">empty</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-133"></span><span>
</span><span id="line-134"></span><span class="hs-comment">-- | /O(1)./ A @Builder@ taking a single character, satisfying</span><span>
</span><span id="line-135"></span><span class="hs-comment">--</span><span>
</span><span id="line-136"></span><span class="hs-comment">--  * @'toLazyText' ('singleton' c) = 'L.singleton' c@</span><span>
</span><span id="line-137"></span><span class="hs-comment">--</span><span>
</span><span id="line-138"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#singleton"><span class="hs-identifier hs-type">singleton</span></a></span><span> </span><span class="hs-glyph">::</span><span class="hs-cpp">
#if defined(ASSERTS)
</span><span>  </span><span class="hs-identifier">HasCallStack</span><span> </span><span class="hs-glyph">=&gt;</span><span class="hs-cpp">
#endif
</span><span>  </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-143"></span><span id="singleton"><span class="annot"><span class="annottext">singleton :: Char -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#singleton"><span class="hs-identifier hs-var hs-var">singleton</span></a></span></span><span> </span><span id="local-6989586621679114356"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679114356"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; (forall s. MArray s -&gt; Int -&gt; ST s Int) -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#writeAtMost"><span class="hs-identifier hs-var">writeAtMost</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">((forall s. MArray s -&gt; Int -&gt; ST s Int) -&gt; Builder)
-&gt; (forall s. MArray s -&gt; Int -&gt; ST s Int) -&gt; Builder
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679114354"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114354"><span class="hs-identifier hs-var">marr</span></a></span></span><span> </span><span id="local-6989586621679114353"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114353"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Char -&gt; ST s Int
forall s. MArray s -&gt; Int -&gt; Char -&gt; ST s Int
</span><a href="Data.Text.Internal.Unsafe.Char.html#unsafeWrite"><span class="hs-identifier hs-var">unsafeWrite</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114354"><span class="hs-identifier hs-var">marr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114353"><span class="hs-identifier hs-var">o</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679114356"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-144"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#singleton"><span class="hs-pragma hs-type">singleton</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-145"></span><span>
</span><span id="line-146"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-147"></span><span>
</span><span id="line-148"></span><span class="hs-comment">-- | /O(1)./ The concatenation of two builders, an associative</span><span>
</span><span id="line-149"></span><span class="hs-comment">-- operation with identity 'empty', satisfying</span><span>
</span><span id="line-150"></span><span class="hs-comment">--</span><span>
</span><span id="line-151"></span><span class="hs-comment">--  * @'toLazyText' ('append' x y) = 'L.append' ('toLazyText' x) ('toLazyText' y)@</span><span>
</span><span id="line-152"></span><span class="hs-comment">--</span><span>
</span><span id="line-153"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#append"><span class="hs-identifier hs-type">append</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-154"></span><span id="append"><span class="annot"><span class="annottext">append :: Builder -&gt; Builder -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#append"><span class="hs-identifier hs-var hs-var">append</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span id="local-6989586621679114352"><span class="annot"><span class="annottext">forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114352"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span id="local-6989586621679114351"><span class="annot"><span class="annottext">forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114351"><span class="hs-identifier hs-var">g</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-var">Builder</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114352"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">((Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; ((Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; (Buffer s -&gt; ST s [Text])
-&gt; Buffer s
-&gt; ST s [Text]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114351"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-155"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#append"><span class="hs-pragma hs-type">append</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-156"></span><span>
</span><span id="line-157"></span><span class="hs-comment">-- TODO: Experiment to find the right threshold.</span><span>
</span><span id="line-158"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#copyLimit"><span class="hs-identifier hs-type">copyLimit</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-159"></span><span id="copyLimit"><span class="annot"><span class="annottext">copyLimit :: Int
</span><a href="Data.Text.Internal.Builder.html#copyLimit"><span class="hs-identifier hs-var hs-var">copyLimit</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">128</span></span><span>
</span><span id="line-160"></span><span>
</span><span id="line-161"></span><span class="hs-comment">-- This function attempts to merge small @Text@ values instead of</span><span>
</span><span id="line-162"></span><span class="hs-comment">-- treating each value as its own chunk.  We may not always want this.</span><span>
</span><span id="line-163"></span><span>
</span><span id="line-164"></span><span class="hs-comment">-- | /O(1)./ A @Builder@ taking a 'S.Text', satisfying</span><span>
</span><span id="line-165"></span><span class="hs-comment">--</span><span>
</span><span id="line-166"></span><span class="hs-comment">--  * @'toLazyText' ('fromText' t) = 'L.fromChunks' [t]@</span><span>
</span><span id="line-167"></span><span class="hs-comment">--</span><span>
</span><span id="line-168"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#fromText"><span class="hs-identifier hs-type">fromText</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">S.Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-169"></span><span id="fromText"><span class="annot"><span class="annottext">fromText :: Text -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#fromText"><span class="hs-identifier hs-var hs-var">fromText</span></a></span></span><span> </span><span id="local-6989586621679114349"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679114349"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679114347"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679114347"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679114346"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114346"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679114345"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114345"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-170"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">S.null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679114349"><span class="hs-identifier hs-var">t</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="Data.Text.Internal.Builder.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-171"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114345"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Text.Internal.Builder.html#copyLimit"><span class="hs-identifier hs-var">copyLimit</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; (forall s. MArray s -&gt; Int -&gt; ST s ()) -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#writeN"><span class="hs-identifier hs-var">writeN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114345"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">((forall s. MArray s -&gt; Int -&gt; ST s ()) -&gt; Builder)
-&gt; (forall s. MArray s -&gt; Int -&gt; ST s ()) -&gt; Builder
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679114341"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114341"><span class="hs-identifier hs-var">marr</span></a></span></span><span> </span><span id="local-6989586621679114340"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114340"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
forall s. MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.Text.Array.html#copyI"><span class="hs-identifier hs-var">A.copyI</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114341"><span class="hs-identifier hs-var">marr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114340"><span class="hs-identifier hs-var">o</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679114347"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114346"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114345"><span class="hs-identifier hs-var">l</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114340"><span class="hs-identifier hs-var">o</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-172"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="Data.Text.Internal.Builder.html#flush"><span class="hs-identifier hs-var">flush</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Builder -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#append"><span class="hs-operator hs-var">`append`</span></a></span><span> </span><span class="annot"><span class="annottext">([Text] -&gt; [Text]) -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#mapBuilder"><span class="hs-identifier hs-var">mapBuilder</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679114349"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; [Text]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-173"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#fromText"><span class="hs-pragma hs-type">fromText</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-176"></span><span class="annot"><span class="hs-pragma">&quot;fromText/pack&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679114336"><span class="annot"><a href="#local-6989586621679114336"><span class="hs-pragma hs-var">s</span></a></span></span><span> </span><span class="hs-pragma">.</span><span>
</span><span id="line-177"></span><span>        </span><span class="annot"><a href="Data.Text.Internal.Builder.html#fromText"><span class="hs-pragma hs-type">fromText</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.html#pack"><span class="hs-pragma hs-type">S.pack</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114336"><span class="hs-pragma hs-type">s</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#fromString"><span class="hs-pragma hs-type">fromString</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114336"><span class="hs-pragma hs-type">s</span></a></span><span>
</span><span id="line-178"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-179"></span><span>
</span><span id="line-180"></span><span class="hs-comment">-- | /O(1)./ A Builder taking a @String@, satisfying</span><span>
</span><span id="line-181"></span><span class="hs-comment">--</span><span>
</span><span id="line-182"></span><span class="hs-comment">--  * @'toLazyText' ('fromString' s) = 'L.fromChunks' [S.pack s]@</span><span>
</span><span id="line-183"></span><span class="hs-comment">--</span><span>
</span><span id="line-184"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#fromString"><span class="hs-identifier hs-type">fromString</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-185"></span><span id="fromString"><span class="annot"><span class="annottext">fromString :: String -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#fromString"><span class="hs-identifier hs-var hs-var">fromString</span></a></span></span><span> </span><span id="local-6989586621679114334"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679114334"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-var">Builder</span></a></span><span> </span><span class="annot"><span class="annottext">((forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
 -&gt; Builder)
-&gt; (forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; Builder
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679114333"><span class="annot"><span class="annottext">Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114333"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span> </span><span id="local-6989586621679114331"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114331"><span class="hs-identifier hs-var">p0</span></a></span></span><span> </span><span id="local-6989586621679114330"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114330"><span class="hs-identifier hs-var">o0</span></a></span></span><span> </span><span id="local-6989586621679114329"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114329"><span class="hs-identifier hs-var">u0</span></a></span></span><span> </span><span id="local-6989586621679114328"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114328"><span class="hs-identifier hs-var">l0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-186"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679114314"><span class="annot"><span class="annottext">loop :: MArray s -&gt; Int -&gt; Int -&gt; Int -&gt; String -&gt; ST s [Text]
</span><a href="#local-6989586621679114314"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679114313"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114313"><span class="hs-identifier hs-var">marr</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679114312"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114312"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679114311"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114311"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679114310"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114310"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114333"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Int -&gt; Int -&gt; Buffer s
forall s. MArray s -&gt; Int -&gt; Int -&gt; Int -&gt; Buffer s
</span><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-var">Buffer</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114313"><span class="hs-identifier hs-var">marr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114312"><span class="hs-identifier hs-var">o</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114311"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114310"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-187"></span><span>        </span><span class="annot"><a href="#local-6989586621679114314"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span id="local-6989586621679114309"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114309"><span class="hs-identifier hs-var">marr</span></a></span></span><span> </span><span id="local-6989586621679114308"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114308"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span id="local-6989586621679114307"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114307"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span id="local-6989586621679114306"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114306"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679114305"><span class="annot"><span class="annottext">s :: String
</span><a href="#local-6989586621679114305"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679114304"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679114304"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679114303"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679114303"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-188"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114306"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-189"></span><span>                </span><span id="local-6989586621679114302"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679114302"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; ST s Array
forall s. MArray s -&gt; ST s Array
</span><a href="Data.Text.Array.html#unsafeFreeze"><span class="hs-identifier hs-var">A.unsafeFreeze</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114309"><span class="hs-identifier hs-var">marr</span></a></span><span>
</span><span id="line-190"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679114300"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679114300"><span class="hs-identifier hs-var hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679114302"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114308"><span class="hs-identifier hs-var">o</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114307"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-191"></span><span>                </span><span id="local-6989586621679114299"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114299"><span class="hs-identifier hs-var">marr'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ST s (MArray s)
forall s. Int -&gt; ST s (MArray s)
</span><a href="Data.Text.Array.html#new"><span class="hs-identifier hs-var">A.new</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114297"><span class="hs-identifier hs-var">chunkSize</span></a></span><span>
</span><span id="line-192"></span><span>                </span><span id="local-6989586621679114296"><span class="annot"><span class="annottext">[Text]
</span><a href="#local-6989586621679114296"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ST s [Text] -&gt; ST s [Text]
forall s a. ST s a -&gt; ST s a
</span><a href="Data.Text.Internal.Unsafe.html#inlineInterleaveST"><span class="hs-identifier hs-var">inlineInterleaveST</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Int -&gt; Int -&gt; String -&gt; ST s [Text]
</span><a href="#local-6989586621679114314"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114299"><span class="hs-identifier hs-var">marr'</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114297"><span class="hs-identifier hs-var">chunkSize</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679114305"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-193"></span><span>                </span><span class="annot"><span class="annottext">[Text] -&gt; ST s [Text]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">([Text] -&gt; ST s [Text]) -&gt; [Text] -&gt; ST s [Text]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679114300"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; [Text]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[Text]
</span><a href="#local-6989586621679114296"><span class="hs-identifier hs-var">ts</span></a></span><span>
</span><span id="line-194"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-195"></span><span>                </span><span id="local-6989586621679114295"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114295"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Char -&gt; ST s Int
forall s. MArray s -&gt; Int -&gt; Char -&gt; ST s Int
</span><a href="Data.Text.Internal.Unsafe.Char.html#unsafeWrite"><span class="hs-identifier hs-var">unsafeWrite</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114309"><span class="hs-identifier hs-var">marr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114308"><span class="hs-identifier hs-var">o</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114307"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679114304"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-196"></span><span>                </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Int -&gt; Int -&gt; String -&gt; ST s [Text]
</span><a href="#local-6989586621679114314"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114309"><span class="hs-identifier hs-var">marr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114308"><span class="hs-identifier hs-var">o</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114307"><span class="hs-identifier hs-var">u</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114295"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114306"><span class="hs-identifier hs-var">l</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114295"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679114303"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-197"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Int -&gt; Int -&gt; String -&gt; ST s [Text]
</span><a href="#local-6989586621679114314"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114331"><span class="hs-identifier hs-var">p0</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114330"><span class="hs-identifier hs-var">o0</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114329"><span class="hs-identifier hs-var">u0</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114328"><span class="hs-identifier hs-var">l0</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679114334"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-198"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-199"></span><span>    </span><span id="local-6989586621679114297"><span class="annot"><span class="annottext">chunkSize :: Int
</span><a href="#local-6989586621679114297"><span class="hs-identifier hs-var hs-var">chunkSize</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Text.Internal.Lazy.html#smallChunkSize"><span class="hs-identifier hs-var">smallChunkSize</span></a></span><span>
</span><span id="line-200"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#fromString"><span class="hs-pragma hs-type">fromString</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-201"></span><span>
</span><span id="line-202"></span><span class="hs-comment">-- | /O(1)./ A @Builder@ taking a lazy @Text@, satisfying</span><span>
</span><span id="line-203"></span><span class="hs-comment">--</span><span>
</span><span id="line-204"></span><span class="hs-comment">--  * @'toLazyText' ('fromLazyText' t) = t@</span><span>
</span><span id="line-205"></span><span class="hs-comment">--</span><span>
</span><span id="line-206"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#fromLazyText"><span class="hs-identifier hs-type">fromLazyText</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.Lazy.html#Text"><span class="hs-identifier hs-type">L.Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-207"></span><span id="fromLazyText"><span class="annot"><span class="annottext">fromLazyText :: Text -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#fromLazyText"><span class="hs-identifier hs-var hs-var">fromLazyText</span></a></span></span><span> </span><span id="local-6989586621679114294"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679114294"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="Data.Text.Internal.Builder.html#flush"><span class="hs-identifier hs-var">flush</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Builder -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#append"><span class="hs-operator hs-var">`append`</span></a></span><span> </span><span class="annot"><span class="annottext">([Text] -&gt; [Text]) -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#mapBuilder"><span class="hs-identifier hs-var">mapBuilder</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; [Text]
</span><a href="Data.Text.Lazy.html#toChunks"><span class="hs-identifier hs-var">L.toChunks</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679114294"><span class="hs-identifier hs-var">ts</span></a></span><span> </span><span class="annot"><span class="annottext">[Text] -&gt; [Text] -&gt; [Text]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-208"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#fromLazyText"><span class="hs-pragma hs-type">fromLazyText</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-209"></span><span>
</span><span id="line-210"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-211"></span><span>
</span><span id="line-212"></span><span class="hs-comment">-- Our internal buffer type</span><span>
</span><span id="line-213"></span><span class="hs-keyword">data</span><span> </span><span id="Buffer"><span class="annot"><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-var">Buffer</span></a></span></span><span> </span><span id="local-6989586621679114501"><span class="annot"><a href="#local-6989586621679114501"><span class="hs-identifier hs-type">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Buffer"><span class="annot"><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-var">Buffer</span></a></span></span><span> </span><span class="hs-pragma">{-# UNPACK</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Array.html#MArray"><span class="hs-identifier hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114501"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-214"></span><span>                       </span><span class="hs-pragma">{-# UNPACK</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>  </span><span class="hs-comment">-- offset</span><span>
</span><span id="line-215"></span><span>                       </span><span class="hs-pragma">{-# UNPACK</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>  </span><span class="hs-comment">-- used units</span><span>
</span><span id="line-216"></span><span>                       </span><span class="hs-pragma">{-# UNPACK</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>  </span><span class="hs-comment">-- length left</span><span>
</span><span id="line-217"></span><span>
</span><span id="line-218"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-219"></span><span>
</span><span id="line-220"></span><span class="hs-comment">-- | /O(n)./ Extract a lazy @Text@ from a @Builder@ with a default</span><span>
</span><span id="line-221"></span><span class="hs-comment">-- buffer size.  The construction work takes place if and when the</span><span>
</span><span id="line-222"></span><span class="hs-comment">-- relevant part of the lazy @Text@ is demanded.</span><span>
</span><span id="line-223"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#toLazyText"><span class="hs-identifier hs-type">toLazyText</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Lazy.html#Text"><span class="hs-identifier hs-type">L.Text</span></a></span><span>
</span><span id="line-224"></span><span id="toLazyText"><span class="annot"><span class="annottext">toLazyText :: Builder -&gt; Text
</span><a href="Data.Text.Internal.Builder.html#toLazyText"><span class="hs-identifier hs-var hs-var">toLazyText</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Builder -&gt; Text
</span><a href="Data.Text.Internal.Builder.html#toLazyTextWith"><span class="hs-identifier hs-var">toLazyTextWith</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Text.Internal.Lazy.html#smallChunkSize"><span class="hs-identifier hs-var">smallChunkSize</span></a></span><span>
</span><span id="line-225"></span><span>
</span><span id="line-226"></span><span class="hs-comment">-- | /O(n)./ Extract a lazy @Text@ from a @Builder@, using the given</span><span>
</span><span id="line-227"></span><span class="hs-comment">-- size for the initial buffer.  The construction work takes place if</span><span>
</span><span id="line-228"></span><span class="hs-comment">-- and when the relevant part of the lazy @Text@ is demanded.</span><span>
</span><span id="line-229"></span><span class="hs-comment">--</span><span>
</span><span id="line-230"></span><span class="hs-comment">-- If the initial buffer is too small to hold all data, subsequent</span><span>
</span><span id="line-231"></span><span class="hs-comment">-- buffers will be the default buffer size.</span><span>
</span><span id="line-232"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#toLazyTextWith"><span class="hs-identifier hs-type">toLazyTextWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Lazy.html#Text"><span class="hs-identifier hs-type">L.Text</span></a></span><span>
</span><span id="line-233"></span><span id="toLazyTextWith"><span class="annot"><span class="annottext">toLazyTextWith :: Int -&gt; Builder -&gt; Text
</span><a href="Data.Text.Internal.Builder.html#toLazyTextWith"><span class="hs-identifier hs-var hs-var">toLazyTextWith</span></a></span></span><span> </span><span id="local-6989586621679114292"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114292"><span class="hs-identifier hs-var">chunkSize</span></a></span></span><span> </span><span id="local-6989586621679114291"><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679114291"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Text] -&gt; Text
</span><a href="Data.Text.Lazy.html#fromChunks"><span class="hs-identifier hs-var">L.fromChunks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(forall s. ST s [Text]) -&gt; [Text]
forall a. (forall s. ST s a) -&gt; a
</span><a href="../../base/src/GHC.ST.html#runST"><span class="hs-identifier hs-var">runST</span></a></span><span> </span><span class="annot"><span class="annottext">((forall s. ST s [Text]) -&gt; [Text])
-&gt; (forall s. ST s [Text]) -&gt; [Text]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-234"></span><span>  </span><span class="annot"><span class="annottext">Int -&gt; ST s (Buffer s)
forall s. Int -&gt; ST s (Buffer s)
</span><a href="Data.Text.Internal.Builder.html#newBuffer"><span class="hs-identifier hs-var">newBuffer</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114292"><span class="hs-identifier hs-var">chunkSize</span></a></span><span> </span><span class="annot"><span class="annottext">ST s (Buffer s) -&gt; (Buffer s -&gt; ST s [Text]) -&gt; ST s [Text]
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Builder
-&gt; forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
</span><a href="Data.Text.Internal.Builder.html#runBuilder"><span class="hs-identifier hs-var hs-var">runBuilder</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679114291"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Builder -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#append"><span class="hs-operator hs-var">`append`</span></a></span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="Data.Text.Internal.Builder.html#flush"><span class="hs-identifier hs-var">flush</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ST s [Text] -&gt; Buffer s -&gt; ST s [Text]
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Text] -&gt; ST s [Text]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-235"></span><span>
</span><span id="line-236"></span><span class="hs-comment">-- | /O(1)./ Pop the strict @Text@ we have constructed so far, if any,</span><span>
</span><span id="line-237"></span><span class="hs-comment">-- yielding a new chunk in the result lazy @Text@.</span><span>
</span><span id="line-238"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#flush"><span class="hs-identifier hs-type">flush</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-239"></span><span id="flush"><span class="annot"><span class="annottext">flush :: Builder
</span><a href="Data.Text.Internal.Builder.html#flush"><span class="hs-identifier hs-var hs-var">flush</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-var">Builder</span></a></span><span> </span><span class="annot"><span class="annottext">((forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
 -&gt; Builder)
-&gt; (forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; Builder
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679114279"><span class="annot"><span class="annottext">Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114279"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679114278"><span class="annot"><span class="annottext">buf :: Buffer s
</span><a href="#local-6989586621679114278"><span class="hs-identifier hs-var">buf</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span> </span><span id="local-6989586621679114277"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114277"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679114276"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114276"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span id="local-6989586621679114275"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114275"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span id="local-6989586621679114274"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114274"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-240"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114275"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-241"></span><span>    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114279"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer s
</span><a href="#local-6989586621679114278"><span class="hs-identifier hs-var">buf</span></a></span><span>
</span><span id="line-242"></span><span>    </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679114273"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679114273"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; ST s Array
forall s. MArray s -&gt; ST s Array
</span><a href="Data.Text.Array.html#unsafeFreeze"><span class="hs-identifier hs-var">A.unsafeFreeze</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114277"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-243"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679114271"><span class="annot"><span class="annottext">b :: Buffer s
</span><a href="#local-6989586621679114271"><span class="hs-identifier hs-var hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Int -&gt; Int -&gt; Buffer s
forall s. MArray s -&gt; Int -&gt; Int -&gt; Int -&gt; Buffer s
</span><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-var">Buffer</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114277"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114276"><span class="hs-identifier hs-var">o</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114275"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114274"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-244"></span><span>                </span><span class="hs-glyph">!</span><span id="local-6989586621679114270"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679114270"><span class="hs-identifier hs-var hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679114273"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114276"><span class="hs-identifier hs-var">o</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114275"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-245"></span><span>            </span><span id="local-6989586621679114269"><span class="annot"><span class="annottext">[Text]
</span><a href="#local-6989586621679114269"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ST s [Text] -&gt; ST s [Text]
forall s a. ST s a -&gt; ST s a
</span><a href="Data.Text.Internal.Unsafe.html#inlineInterleaveST"><span class="hs-identifier hs-var">inlineInterleaveST</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114279"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer s
</span><a href="#local-6989586621679114271"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-246"></span><span>            </span><span class="annot"><span class="annottext">[Text] -&gt; ST s [Text]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">([Text] -&gt; ST s [Text]) -&gt; [Text] -&gt; ST s [Text]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679114270"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; [Text]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[Text]
</span><a href="#local-6989586621679114269"><span class="hs-identifier hs-var">ts</span></a></span><span>
</span><span id="line-247"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#flush"><span class="hs-pragma hs-type">flush</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-248"></span><span class="hs-comment">-- defer inlining so that flush/flush rule may fire.</span><span>
</span><span id="line-249"></span><span>
</span><span id="line-250"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-251"></span><span>
</span><span id="line-252"></span><span class="hs-comment">-- | Sequence an ST operation on the buffer</span><span>
</span><span id="line-253"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#withBuffer"><span class="hs-identifier hs-type">withBuffer</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679114484"><span class="annot"><a href="#local-6989586621679114484"><span class="hs-identifier hs-type">s</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114484"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114484"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114484"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-254"></span><span id="withBuffer"><span class="annot"><span class="annottext">withBuffer :: (forall s. Buffer s -&gt; ST s (Buffer s)) -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#withBuffer"><span class="hs-identifier hs-var hs-var">withBuffer</span></a></span></span><span> </span><span id="local-6989586621679114266"><span class="annot"><span class="annottext">forall s. Buffer s -&gt; ST s (Buffer s)
</span><a href="#local-6989586621679114266"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-var">Builder</span></a></span><span> </span><span class="annot"><span class="annottext">((forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
 -&gt; Builder)
-&gt; (forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; Builder
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679114264"><span class="annot"><span class="annottext">Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114264"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679114263"><span class="annot"><span class="annottext">Buffer s
</span><a href="#local-6989586621679114263"><span class="hs-identifier hs-var">buf</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Buffer s -&gt; ST s (Buffer s)
forall s. Buffer s -&gt; ST s (Buffer s)
</span><a href="#local-6989586621679114266"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer s
</span><a href="#local-6989586621679114263"><span class="hs-identifier hs-var">buf</span></a></span><span> </span><span class="annot"><span class="annottext">ST s (Buffer s) -&gt; (Buffer s -&gt; ST s [Text]) -&gt; ST s [Text]
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114264"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-255"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#withBuffer"><span class="hs-pragma hs-type">withBuffer</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-256"></span><span>
</span><span id="line-257"></span><span class="hs-comment">-- | Get the size of the buffer</span><span>
</span><span id="line-258"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#withSize"><span class="hs-identifier hs-type">withSize</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-259"></span><span id="withSize"><span class="annot"><span class="annottext">withSize :: (Int -&gt; Builder) -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#withSize"><span class="hs-identifier hs-var hs-var">withSize</span></a></span></span><span> </span><span id="local-6989586621679114261"><span class="annot"><span class="annottext">Int -&gt; Builder
</span><a href="#local-6989586621679114261"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-var">Builder</span></a></span><span> </span><span class="annot"><span class="annottext">((forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
 -&gt; Builder)
-&gt; (forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; Builder
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679114260"><span class="annot"><span class="annottext">Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114260"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679114259"><span class="annot"><span class="annottext">buf :: Buffer s
</span><a href="#local-6989586621679114259"><span class="hs-identifier hs-var">buf</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679114258"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114258"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-260"></span><span>    </span><span class="annot"><span class="annottext">Builder
-&gt; forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
</span><a href="Data.Text.Internal.Builder.html#runBuilder"><span class="hs-identifier hs-var hs-var">runBuilder</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Builder
</span><a href="#local-6989586621679114261"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114258"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114260"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Buffer s
</span><a href="#local-6989586621679114259"><span class="hs-identifier hs-var">buf</span></a></span><span>
</span><span id="line-261"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#withSize"><span class="hs-pragma hs-type">withSize</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-262"></span><span>
</span><span id="line-263"></span><span class="hs-comment">-- | Map the resulting list of texts.</span><span>
</span><span id="line-264"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#mapBuilder"><span class="hs-identifier hs-type">mapBuilder</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">S.Text</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">S.Text</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-265"></span><span id="mapBuilder"><span class="annot"><span class="annottext">mapBuilder :: ([Text] -&gt; [Text]) -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#mapBuilder"><span class="hs-identifier hs-var hs-var">mapBuilder</span></a></span></span><span> </span><span id="local-6989586621679114257"><span class="annot"><span class="annottext">[Text] -&gt; [Text]
</span><a href="#local-6989586621679114257"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-var">Builder</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">([Text] -&gt; [Text]) -&gt; ST s [Text] -&gt; ST s [Text]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">[Text] -&gt; [Text]
</span><a href="#local-6989586621679114257"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(ST s [Text] -&gt; ST s [Text])
-&gt; (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-266"></span><span>
</span><span id="line-267"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-268"></span><span>
</span><span id="line-269"></span><span class="hs-comment">-- | Ensure that there are at least @n@ many elements available.</span><span>
</span><span id="line-270"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#ensureFree"><span class="hs-identifier hs-type">ensureFree</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-271"></span><span id="ensureFree"><span class="annot"><span class="annottext">ensureFree :: Int -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#ensureFree"><span class="hs-identifier hs-var hs-var">ensureFree</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679114254"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114254"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Builder) -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#withSize"><span class="hs-identifier hs-var">withSize</span></a></span><span> </span><span class="annot"><span class="annottext">((Int -&gt; Builder) -&gt; Builder) -&gt; (Int -&gt; Builder) -&gt; Builder
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679114253"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114253"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-272"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114254"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114253"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-273"></span><span>    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="Data.Text.Internal.Builder.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-274"></span><span>    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="Data.Text.Internal.Builder.html#flush"><span class="hs-identifier hs-var">flush</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Builder -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#append%27"><span class="hs-operator hs-var">`append'`</span></a></span><span> </span><span class="annot"><span class="annottext">(forall s. Buffer s -&gt; ST s (Buffer s)) -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#withBuffer"><span class="hs-identifier hs-var">withBuffer</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ST s (Buffer s) -&gt; Buffer s -&gt; ST s (Buffer s)
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ST s (Buffer s)
forall s. Int -&gt; ST s (Buffer s)
</span><a href="Data.Text.Internal.Builder.html#newBuffer"><span class="hs-identifier hs-var">newBuffer</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><a href="../../ghc-prim/src/GHC.Classes.html#max"><span class="hs-identifier hs-var">max</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114254"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.Text.Internal.Lazy.html#smallChunkSize"><span class="hs-identifier hs-var">smallChunkSize</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-275"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#ensureFree"><span class="hs-pragma hs-type">ensureFree</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-276"></span><span>
</span><span id="line-277"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#writeAtMost"><span class="hs-identifier hs-type">writeAtMost</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679114517"><span class="annot"><a href="#local-6989586621679114517"><span class="hs-identifier hs-type">s</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="Data.Text.Array.html#MArray"><span class="hs-identifier hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114517"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114517"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-278"></span><span id="writeAtMost"><span class="annot"><span class="annottext">writeAtMost :: Int -&gt; (forall s. MArray s -&gt; Int -&gt; ST s Int) -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#writeAtMost"><span class="hs-identifier hs-var hs-var">writeAtMost</span></a></span></span><span> </span><span id="local-6989586621679114250"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114250"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679114249"><span class="annot"><span class="annottext">forall s. MArray s -&gt; Int -&gt; ST s Int
</span><a href="#local-6989586621679114249"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#ensureFree"><span class="hs-identifier hs-var">ensureFree</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114250"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Builder -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#append%27"><span class="hs-operator hs-var">`append'`</span></a></span><span> </span><span class="annot"><span class="annottext">(forall s. Buffer s -&gt; ST s (Buffer s)) -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#withBuffer"><span class="hs-identifier hs-var">withBuffer</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(MArray s -&gt; Int -&gt; ST s Int) -&gt; Buffer s -&gt; ST s (Buffer s)
forall s.
(MArray s -&gt; Int -&gt; ST s Int) -&gt; Buffer s -&gt; ST s (Buffer s)
</span><a href="Data.Text.Internal.Builder.html#writeBuffer"><span class="hs-identifier hs-var">writeBuffer</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; ST s Int
forall s. MArray s -&gt; Int -&gt; ST s Int
</span><a href="#local-6989586621679114249"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-279"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#writeAtMost"><span class="hs-pragma hs-type">writeAtMost</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-280"></span><span>
</span><span id="line-281"></span><span class="hs-comment">-- | Ensure that @n@ many elements are available, and then use @f@ to</span><span>
</span><span id="line-282"></span><span class="hs-comment">-- write some elements into the memory.</span><span>
</span><span id="line-283"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#writeN"><span class="hs-identifier hs-type">writeN</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679114508"><span class="annot"><a href="#local-6989586621679114508"><span class="hs-identifier hs-type">s</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="Data.Text.Array.html#MArray"><span class="hs-identifier hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114508"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114508"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-284"></span><span id="writeN"><span class="annot"><span class="annottext">writeN :: Int -&gt; (forall s. MArray s -&gt; Int -&gt; ST s ()) -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#writeN"><span class="hs-identifier hs-var hs-var">writeN</span></a></span></span><span> </span><span id="local-6989586621679114247"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114247"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679114246"><span class="annot"><span class="annottext">forall s. MArray s -&gt; Int -&gt; ST s ()
</span><a href="#local-6989586621679114246"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; (forall s. MArray s -&gt; Int -&gt; ST s Int) -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#writeAtMost"><span class="hs-identifier hs-var">writeAtMost</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114247"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679114243"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114243"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679114242"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114242"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; ST s ()
forall s. MArray s -&gt; Int -&gt; ST s ()
</span><a href="#local-6989586621679114246"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114243"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114242"><span class="hs-identifier hs-var">o</span></a></span><span> </span><span class="annot"><span class="annottext">ST s () -&gt; ST s Int -&gt; ST s Int
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; ST s Int
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114247"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-285"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#writeN"><span class="hs-pragma hs-type">writeN</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-286"></span><span>
</span><span id="line-287"></span><span id="local-6989586621679114474"><span class="annot"><a href="Data.Text.Internal.Builder.html#writeBuffer"><span class="hs-identifier hs-type">writeBuffer</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Array.html#MArray"><span class="hs-identifier hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114474"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114474"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114474"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114474"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114474"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-288"></span><span id="writeBuffer"><span class="annot"><span class="annottext">writeBuffer :: forall s.
(MArray s -&gt; Int -&gt; ST s Int) -&gt; Buffer s -&gt; ST s (Buffer s)
</span><a href="Data.Text.Internal.Builder.html#writeBuffer"><span class="hs-identifier hs-var hs-var">writeBuffer</span></a></span></span><span> </span><span id="local-6989586621679114236"><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; ST s Int
</span><a href="#local-6989586621679114236"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span> </span><span id="local-6989586621679114235"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114235"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679114234"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114234"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span id="local-6989586621679114233"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114233"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span id="local-6989586621679114232"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114232"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-289"></span><span>    </span><span id="local-6989586621679114231"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114231"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; ST s Int
</span><a href="#local-6989586621679114236"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114235"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114234"><span class="hs-identifier hs-var">o</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114233"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-290"></span><span>    </span><span class="annot"><span class="annottext">Buffer s -&gt; ST s (Buffer s)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Buffer s -&gt; ST s (Buffer s)) -&gt; Buffer s -&gt; ST s (Buffer s)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Int -&gt; Int -&gt; Buffer s
forall s. MArray s -&gt; Int -&gt; Int -&gt; Int -&gt; Buffer s
</span><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-var">Buffer</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114235"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114234"><span class="hs-identifier hs-var">o</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114233"><span class="hs-identifier hs-var">u</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114231"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114232"><span class="hs-identifier hs-var">l</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114231"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-291"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#writeBuffer"><span class="hs-pragma hs-type">writeBuffer</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-292"></span><span>
</span><span id="line-293"></span><span id="local-6989586621679114490"><span class="annot"><a href="Data.Text.Internal.Builder.html#newBuffer"><span class="hs-identifier hs-type">newBuffer</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114490"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-type">Buffer</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114490"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-294"></span><span id="newBuffer"><span class="annot"><span class="annottext">newBuffer :: forall s. Int -&gt; ST s (Buffer s)
</span><a href="Data.Text.Internal.Builder.html#newBuffer"><span class="hs-identifier hs-var hs-var">newBuffer</span></a></span></span><span> </span><span id="local-6989586621679114228"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114228"><span class="hs-identifier hs-var">size</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-295"></span><span>    </span><span id="local-6989586621679114227"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114227"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ST s (MArray s)
forall s. Int -&gt; ST s (MArray s)
</span><a href="Data.Text.Array.html#new"><span class="hs-identifier hs-var">A.new</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114228"><span class="hs-identifier hs-var">size</span></a></span><span>
</span><span id="line-296"></span><span>    </span><span class="annot"><span class="annottext">Buffer s -&gt; ST s (Buffer s)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Buffer s -&gt; ST s (Buffer s)) -&gt; Buffer s -&gt; ST s (Buffer s)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Int -&gt; Int -&gt; Buffer s
forall s. MArray s -&gt; Int -&gt; Int -&gt; Int -&gt; Buffer s
</span><a href="Data.Text.Internal.Builder.html#Buffer"><span class="hs-identifier hs-var">Buffer</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679114227"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679114228"><span class="hs-identifier hs-var">size</span></a></span><span>
</span><span id="line-297"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#newBuffer"><span class="hs-pragma hs-type">newBuffer</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-298"></span><span>
</span><span id="line-299"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-300"></span><span class="hs-comment">-- Some nice rules for Builder</span><span>
</span><span id="line-301"></span><span>
</span><span id="line-302"></span><span class="hs-comment">-- This function makes GHC understand that 'writeN' and 'ensureFree'</span><span>
</span><span id="line-303"></span><span class="hs-comment">-- are *not* recursive in the precense of the rewrite rules below.</span><span>
</span><span id="line-304"></span><span class="hs-comment">-- This is not needed with GHC 7+.</span><span>
</span><span id="line-305"></span><span class="annot"><a href="Data.Text.Internal.Builder.html#append%27"><span class="hs-identifier hs-type">append'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-306"></span><span id="append%27"><span class="annot"><span class="annottext">append' :: Builder -&gt; Builder -&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#append%27"><span class="hs-identifier hs-var hs-var">append'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span id="local-6989586621679114226"><span class="annot"><span class="annottext">forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114226"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span id="local-6989586621679114225"><span class="annot"><span class="annottext">forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114225"><span class="hs-identifier hs-var">g</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; Builder
</span><a href="Data.Text.Internal.Builder.html#Builder"><span class="hs-identifier hs-var">Builder</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114226"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">((Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; ((Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text])
-&gt; (Buffer s -&gt; ST s [Text])
-&gt; Buffer s
-&gt; ST s [Text]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
forall s. (Buffer s -&gt; ST s [Text]) -&gt; Buffer s -&gt; ST s [Text]
</span><a href="#local-6989586621679114225"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-307"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#append%27"><span class="hs-pragma hs-type">append'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-308"></span><span>
</span><span id="line-309"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-310"></span><span>
</span><span id="line-311"></span><span class="annot"><span class="hs-pragma">&quot;append/writeAtMost&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679114224"><span class="annot"><a href="#local-6989586621679114224"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679114223"><span class="annot"><a href="#local-6989586621679114223"><span class="hs-pragma hs-var">b</span></a></span></span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679114222"><span class="annot"><a href="#local-6989586621679114222"><span class="hs-pragma hs-var">f</span></a></span></span><span class="hs-pragma">::</span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679114221"><span class="annot"><a href="#local-6989586621679114221"><span class="hs-pragma hs-type">s</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Text.Array.html#MArray"><span class="hs-pragma hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114221"><span class="hs-pragma hs-type">s</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-pragma hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114221"><span class="hs-pragma hs-type">s</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-312"></span><span>                           </span><span class="hs-pragma">(</span><span id="local-6989586621679114220"><span class="annot"><a href="#local-6989586621679114220"><span class="hs-pragma hs-var">g</span></a></span></span><span class="hs-pragma">::</span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679114219"><span class="annot"><a href="#local-6989586621679114219"><span class="hs-pragma hs-type">s</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Text.Array.html#MArray"><span class="hs-pragma hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114219"><span class="hs-pragma hs-type">s</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-pragma hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114219"><span class="hs-pragma hs-type">s</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span class="hs-pragma">)</span><span> </span><span id="local-6989586621679114218"><span class="annot"><a href="#local-6989586621679114218"><span class="hs-pragma hs-var">ws</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-313"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Builder.html#append"><span class="hs-pragma hs-type">append</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#writeAtMost"><span class="hs-pragma hs-type">writeAtMost</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114224"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114222"><span class="hs-pragma hs-type">f</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#append"><span class="hs-pragma hs-type">append</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#writeAtMost"><span class="hs-pragma hs-type">writeAtMost</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114223"><span class="hs-pragma hs-type">b</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114220"><span class="hs-pragma hs-type">g</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679114218"><span class="hs-pragma hs-type">ws</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-314"></span><span>        </span><span class="annot"><a href="Data.Text.Internal.Builder.html#append"><span class="hs-pragma hs-type">append</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#writeAtMost"><span class="hs-pragma hs-type">writeAtMost</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679114224"><span class="hs-pragma hs-type">a</span></a></span><span class="annot"><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-pragma hs-type">+</span></a></span><span class="annot"><a href="#local-6989586621679114223"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679114217"><span class="annot"><a href="#local-6989586621679114217"><span class="hs-pragma hs-var">marr</span></a></span></span><span> </span><span id="local-6989586621679114216"><span class="annot"><a href="#local-6989586621679114216"><span class="hs-pragma hs-var">o</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679114222"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114217"><span class="hs-pragma hs-type">marr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114216"><span class="hs-pragma hs-type">o</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-pragma hs-type">&gt;&gt;=</span></a></span><span> </span><span class="hs-pragma">\</span><span> </span><span id="local-6989586621679114215"><span class="annot"><a href="#local-6989586621679114215"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span>
</span><span id="line-315"></span><span>                                    </span><span class="annot"><a href="#local-6989586621679114220"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114217"><span class="hs-pragma hs-type">marr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679114216"><span class="hs-pragma hs-type">o</span></a></span><span class="annot"><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-pragma hs-type">+</span></a></span><span class="annot"><a href="#local-6989586621679114215"><span class="hs-pragma hs-type">n</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-pragma hs-type">&gt;&gt;=</span></a></span><span> </span><span class="hs-pragma">\</span><span> </span><span id="local-6989586621679114214"><span class="annot"><a href="#local-6989586621679114214"><span class="hs-pragma hs-var">m</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span>
</span><span id="line-316"></span><span>                                    </span><span class="hs-pragma">let</span><span> </span><span id="local-6989586621679114213"><span class="annot"><a href="#local-6989586621679114213"><span class="hs-pragma hs-var hs-var">s</span></a></span></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679114215"><span class="hs-pragma hs-type">n</span></a></span><span class="annot"><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-pragma hs-type">+</span></a></span><span class="annot"><a href="#local-6989586621679114214"><span class="hs-pragma hs-type">m</span></a></span><span> </span><span class="hs-pragma">in</span><span> </span><span class="annot"><a href="#local-6989586621679114213"><span class="hs-pragma hs-type">s</span></a></span><span> </span><span class="hs-pragma">`</span><span class="hs-pragma">seq</span><span class="hs-pragma">`</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#return"><span class="hs-pragma hs-type">return</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114213"><span class="hs-pragma hs-type">s</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679114218"><span class="hs-pragma hs-type">ws</span></a></span><span>
</span><span id="line-317"></span><span>
</span><span id="line-318"></span><span class="annot"><span class="hs-pragma">&quot;writeAtMost/writeAtMost&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679114212"><span class="annot"><a href="#local-6989586621679114212"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679114211"><span class="annot"><a href="#local-6989586621679114211"><span class="hs-pragma hs-var">b</span></a></span></span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679114210"><span class="annot"><a href="#local-6989586621679114210"><span class="hs-pragma hs-var">f</span></a></span></span><span class="hs-pragma">::</span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679114209"><span class="annot"><a href="#local-6989586621679114209"><span class="hs-pragma hs-type">s</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Text.Array.html#MArray"><span class="hs-pragma hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114209"><span class="hs-pragma hs-type">s</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-pragma hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114209"><span class="hs-pragma hs-type">s</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-319"></span><span>                           </span><span class="hs-pragma">(</span><span id="local-6989586621679114208"><span class="annot"><a href="#local-6989586621679114208"><span class="hs-pragma hs-var">g</span></a></span></span><span class="hs-pragma">::</span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679114207"><span class="annot"><a href="#local-6989586621679114207"><span class="hs-pragma hs-type">s</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Text.Array.html#MArray"><span class="hs-pragma hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114207"><span class="hs-pragma hs-type">s</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-pragma hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114207"><span class="hs-pragma hs-type">s</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">.</span><span>
</span><span id="line-320"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Builder.html#append"><span class="hs-pragma hs-type">append</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#writeAtMost"><span class="hs-pragma hs-type">writeAtMost</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114212"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114210"><span class="hs-pragma hs-type">f</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#writeAtMost"><span class="hs-pragma hs-type">writeAtMost</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114211"><span class="hs-pragma hs-type">b</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114208"><span class="hs-pragma hs-type">g</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-321"></span><span>        </span><span class="annot"><a href="Data.Text.Internal.Builder.html#writeAtMost"><span class="hs-pragma hs-type">writeAtMost</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679114212"><span class="hs-pragma hs-type">a</span></a></span><span class="annot"><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-pragma hs-type">+</span></a></span><span class="annot"><a href="#local-6989586621679114211"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679114206"><span class="annot"><a href="#local-6989586621679114206"><span class="hs-pragma hs-var">marr</span></a></span></span><span> </span><span id="local-6989586621679114205"><span class="annot"><a href="#local-6989586621679114205"><span class="hs-pragma hs-var">o</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679114210"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114206"><span class="hs-pragma hs-type">marr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114205"><span class="hs-pragma hs-type">o</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-pragma hs-type">&gt;&gt;=</span></a></span><span> </span><span class="hs-pragma">\</span><span> </span><span id="local-6989586621679114204"><span class="annot"><a href="#local-6989586621679114204"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span>
</span><span id="line-322"></span><span>                            </span><span class="annot"><a href="#local-6989586621679114208"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114206"><span class="hs-pragma hs-type">marr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679114205"><span class="hs-pragma hs-type">o</span></a></span><span class="annot"><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-pragma hs-type">+</span></a></span><span class="annot"><a href="#local-6989586621679114204"><span class="hs-pragma hs-type">n</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-pragma hs-type">&gt;&gt;=</span></a></span><span> </span><span class="hs-pragma">\</span><span> </span><span id="local-6989586621679114203"><span class="annot"><a href="#local-6989586621679114203"><span class="hs-pragma hs-var">m</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span>
</span><span id="line-323"></span><span>                            </span><span class="hs-pragma">let</span><span> </span><span id="local-6989586621679114202"><span class="annot"><a href="#local-6989586621679114202"><span class="hs-pragma hs-var hs-var">s</span></a></span></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679114204"><span class="hs-pragma hs-type">n</span></a></span><span class="annot"><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-pragma hs-type">+</span></a></span><span class="annot"><a href="#local-6989586621679114203"><span class="hs-pragma hs-type">m</span></a></span><span> </span><span class="hs-pragma">in</span><span> </span><span class="annot"><a href="#local-6989586621679114202"><span class="hs-pragma hs-type">s</span></a></span><span> </span><span class="hs-pragma">`</span><span class="hs-pragma">seq</span><span class="hs-pragma">`</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#return"><span class="hs-pragma hs-type">return</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114202"><span class="hs-pragma hs-type">s</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-324"></span><span>
</span><span id="line-325"></span><span class="annot"><span class="hs-pragma">&quot;ensureFree/ensureFree&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679114201"><span class="annot"><a href="#local-6989586621679114201"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679114200"><span class="annot"><a href="#local-6989586621679114200"><span class="hs-pragma hs-var">b</span></a></span></span><span> </span><span class="hs-pragma">.</span><span>
</span><span id="line-326"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Builder.html#append"><span class="hs-pragma hs-type">append</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#ensureFree"><span class="hs-pragma hs-type">ensureFree</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114201"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Builder.html#ensureFree"><span class="hs-pragma hs-type">ensureFree</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114200"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#ensureFree"><span class="hs-pragma hs-type">ensureFree</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#max"><span class="hs-pragma hs-type">max</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114201"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679114200"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-327"></span><span>
</span><span id="line-328"></span><span class="annot"><span class="hs-pragma">&quot;flush/flush&quot;</span></span><span>
</span><span id="line-329"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Builder.html#append"><span class="hs-pragma hs-type">append</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#flush"><span class="hs-pragma hs-type">flush</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#flush"><span class="hs-pragma hs-type">flush</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Builder.html#flush"><span class="hs-pragma hs-type">flush</span></a></span><span>
</span><span id="line-330"></span><span>
</span><span id="line-331"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-332"></span></pre></body></html>